/**
 * @description 封装跳转
 * @author xujs
 */

function goto(url, data, animationType = 'pop-in') {
	url += (url.indexOf('?') < 0? '?' : '&') + _param(data)
	
	uni.navigateTo({
		url,
		animationType,
		fail(err) {
			console.log(err)
		}
	})
}


function _param(data) {
	let url = ''
	for (let k in data) {
		let val = data[k] !== undefined? data[k] : ''
		url += `&${k}=${val}`
	}
	return url? url.substring(1) : ''
}


export default goto